package com.zookeeper.te1;

import org.apache.zookeeper.WatchedEvent;
import org.apache.zookeeper.Watcher;

/**
 * 作者: LCG
 * 日期: 2019/9/16 19:08
 * 描述:
 */
public class TestWatcher implements Watcher {
    @Override
    public void process(WatchedEvent event) {

        if(Event.EventType.NodeChildrenChanged.getIntValue()==event.getType().getIntValue()){
            System.out.println("======子节点的数据变更=====");
        }else if(Event.EventType.NodeCreated.getIntValue()==event.getType().getIntValue()){
            System.out.println("======创建节点=====");
        }else if(Event.EventType.NodeDataChanged.getIntValue()==event.getType().getIntValue()){
            System.out.println("======当前节点的数据发生变更=====");
        }else if(Event.EventType.NodeDeleted.getIntValue()==event.getType().getIntValue()){
            System.out.println("======当前节点被删除=====");
        }else if(Event.EventType.None.getIntValue()==event.getType().getIntValue()){
            System.out.println("========None==========");
        }
    }
}
